class Solution {
public:
    int n;
    int st[50];
    vector<vector<int>> ans;
    void dfs(int idx, vector<int>nums, vector<int>res) {
        if (idx == n) {
            cout << "11" << endl;
            ans.push_back(res);
            return;
        }
        for (int i = 0; i < n; i++) {
            if (!st[nums[i] + 20]) {
                st[nums[i] + 20] = 1;
                res.push_back(nums[i]);
                dfs(idx + 1, nums, res);
                res.pop_back();
                st[nums[i] + 20] = 0;
            }
        }
    }
    vector<vector<int>> permute(vector<int>& nums) {
        n = nums.size();
        vector<int>res;
        dfs(0, nums, res);
        return ans;
    }
};